package com.ruoyi.jiajia.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.JiajiaWorkerJiedanDetail;
import com.ruoyi.system.service.IJiajiaWorkerJiedanDetailService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 接单状态详情Controller
 * 
 * @author knd
 * @date 2021-10-19
 */
@Controller
@RequestMapping("/jiajia/jiajiajiedandetail")
public class JiajiaWorkerJiedanDetailController extends BaseController
{
    private String prefix = "jiajia/jiajiajiedandetail";

    @Autowired
    private IJiajiaWorkerJiedanDetailService jiajiaWorkerJiedanDetailService;

    @RequiresPermissions("jiajia:jiajiajiedandetail:view")
    @GetMapping()
    public String jiajiajiedandetail()
    {
        return prefix + "/jiajiajiedandetail";
    }

    /**
     * 查询接单状态详情列表
     */
    @RequiresPermissions("jiajia:jiajiajiedandetail:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(JiajiaWorkerJiedanDetail jiajiaWorkerJiedanDetail)
    {
        startPage();
        List<JiajiaWorkerJiedanDetail> list = jiajiaWorkerJiedanDetailService.selectJiajiaWorkerJiedanDetailList(jiajiaWorkerJiedanDetail);
        return getDataTable(list);
    }

    /**
     * 导出接单状态详情列表
     */
    @RequiresPermissions("jiajia:jiajiajiedandetail:export")
    @Log(title = "接单状态详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(JiajiaWorkerJiedanDetail jiajiaWorkerJiedanDetail)
    {
        List<JiajiaWorkerJiedanDetail> list = jiajiaWorkerJiedanDetailService.selectJiajiaWorkerJiedanDetailList(jiajiaWorkerJiedanDetail);
        ExcelUtil<JiajiaWorkerJiedanDetail> util = new ExcelUtil<JiajiaWorkerJiedanDetail>(JiajiaWorkerJiedanDetail.class);
        return util.exportExcel(list, "接单状态详情数据");
    }

    /**
     * 新增接单状态详情
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存接单状态详情
     */
    @RequiresPermissions("jiajia:jiajiajiedandetail:add")
    @Log(title = "接单状态详情", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(JiajiaWorkerJiedanDetail jiajiaWorkerJiedanDetail)
    {
        return toAjax(jiajiaWorkerJiedanDetailService.insertJiajiaWorkerJiedanDetail(jiajiaWorkerJiedanDetail));
    }

    /**
     * 修改接单状态详情
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        JiajiaWorkerJiedanDetail jiajiaWorkerJiedanDetail = jiajiaWorkerJiedanDetailService.selectJiajiaWorkerJiedanDetailById(id);
        mmap.put("jiajiaWorkerJiedanDetail", jiajiaWorkerJiedanDetail);
        return prefix + "/edit";
    }

    /**
     * 修改保存接单状态详情
     */
    @RequiresPermissions("jiajia:jiajiajiedandetail:edit")
    @Log(title = "接单状态详情", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(JiajiaWorkerJiedanDetail jiajiaWorkerJiedanDetail)
    {
        return toAjax(jiajiaWorkerJiedanDetailService.updateJiajiaWorkerJiedanDetail(jiajiaWorkerJiedanDetail));
    }

    /**
     * 删除接单状态详情
     */
    @RequiresPermissions("jiajia:jiajiajiedandetail:remove")
    @Log(title = "接单状态详情", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(jiajiaWorkerJiedanDetailService.deleteJiajiaWorkerJiedanDetailByIds(ids));
    }
}
